

package com.hazelcast.client.config;

import com.hazelcast.config.BaseMetricsConfig;

import java.util.Objects;

/**
 * Client-side metrics collection configuration.
 *
 * @since 4.0
 */
public class ClientMetricsConfig extends BaseMetricsConfig<ClientMetricsConfig> {
    public ClientMetricsConfig() {
        super();
    }

    public ClientMetricsConfig(ClientMetricsConfig metricsConfig) {
        super(metricsConfig);
    }

    @Override
    @SuppressWarnings("checkstyle:NPathComplexity")
    public final boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof ClientMetricsConfig that)) {
            return false;
        }

        if (enabled != that.enabled) {
            return false;
        }
        if (collectionFrequencySeconds != that.collectionFrequencySeconds) {
            return false;
        }
        return Objects.equals(jmxConfig, that.jmxConfig);
    }

    @Override
    public final int hashCode() {
        int result = (enabled ? 1 : 0);
        result = 31 * result + (jmxConfig != null ? jmxConfig.hashCode() : 0);
        result = 31 * result + collectionFrequencySeconds;
        return result;
    }

    @Override
    public String toString() {
        return "ClientMetricsConfig{" + "enabled=" + enabled + ", jmxConfig=" + jmxConfig + ", collectionFrequencySeconds=" + collectionFrequencySeconds + '}';
    }

}
